﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example03.aspx.cs" Inherits="Chapter27.Example03" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 27-3 与窗口进行交互</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
</head>
<body id="bod">
    <p>
        <button id="scroll">Scroll</button>
        <button id="print">Print</button>
        <button id="close">Close</button>
    </p>
    <p>
        There are lots of different kinds of fruit - there are you over 500 varieties 
        of banana alone. By the time we add the countless types of apples, oranges, 
        and other well-known fruit, we are faced with thousands of choices.
        <img id="apple" class="fruits images" src="images/apple.png" alt="apple" />
        One of the most interesting aspects of fruit is the variety available in 
        each country. I live near London, in an area which is known for 
        its apples.
        <img id="banana" src="images/banana-small.png" alt="small banana" />
        When traveling in Asia, I was struck by now many different
        Kinds of banana were available - many of which had unique flavors and 
        Which were only available within a small region.

        And, of course, therer are fruits which are truly unique - I am put in mind
        of the durian, which is whdely consumed in SE Asia and is known as the
        "king of fruits." The durian is largely unknown in Europe and the USA - if
        it is known at all, it is for the overwhelming smell, which is compared
        to a combination of almonds, rotten onions and gym socks.
    </p>
    <script>
        var buttons = document.getElementsByTagName("button");
        for (var i = 0; i < buttons.length; i++) {
            buttons[i].onclick = handleButtonPress;
        }
        function handleButtonPress(e) {
            if (e.target.id == "print") {
                window.print();
            } else if (e.target.id == "close") {
                window.close();
            } else {
                window.scrollTo(0, 400);
            }
        }
    </script>
</body>
</html>
